# -*- coding: utf-8 -*-
from php4dvd.pages.page import Page
from selenium.webdriver.common.by import By


class InternalPage(Page):

    @property
    def logout_button(self):
        return self.driver.find_element_by_css_selector("nav a[href $= '?logout']")

    @property
    def add_film_link(self):
        return self.driver.find_element_by_xpath(".//*[@id='content']/section/nav/ul/li[1]/div/div/a")

    @property
    def is_this_page(self):
        return self.is_element_visible((By.CSS_SELECTOR, "nav"))

    @property
    def is_error(self):
        return self.driver.find_element_by_css_selector("label.error")

    @property
    def is_added_film(self):
        return self.driver.find_element_by_id("movie")

    @property
    def is_any_film(self):
        return self.driver.find_element_by_css_selector("div.nocover")

    @property
    def film_count(self):
        return len(self.driver.find_elements(By.CSS_SELECTOR, "div.nocover"))

    @property
    def select_movie(self):
        return self.driver.find_element_by_css_selector("div.nocover")

    @property
    def del_film_link(self):
        return self.driver.find_element_by_css_selector("img[alt=\"Remove\"]")

    @property
    def search_field(self):
        return self.driver.find_element_by_id("q")
